#ifndef UDPWIDGET_H
#define UDPWIDGET_H

#include <QWidget>
#include <QUdpSocket>

QT_BEGIN_NAMESPACE
namespace Ui { class UdpWidget; }
QT_END_NAMESPACE

class UdpWidget : public QWidget
{
    Q_OBJECT

public:
    UdpWidget(QWidget *parent = nullptr);
    ~UdpWidget();

    ///构造函数中初始化数据
    void initDataSlot();
    ///获取本地IP
    QString getLocalIP();
private slots:
    //自定义槽函数
    void onSocketStateChange(QAbstractSocket::SocketState socketState);
    void onSocketReadyRead() ; //读取socket传入的数据

    void on_sendUnicastMsgBtn_clicked();

    void on_SendBroadcastMsgBtn_clicked();

    void on_pushButton_bindingPort_clicked();

    void on_pushButton_unbound_clicked();

    void on_pushButton_cleanText_clicked();

private:
    Ui::UdpWidget *ui;

    QUdpSocket * mUdpSocket = nullptr;
};
#endif // UDPWIDGET_H
